home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR02 / DCGAMES1.ZIP / SCRIPTS.ZIP / DCSCRREF.DOC < prev   
Text File  |  1993-04-08  |  66KB  |  2,557 lines

  1. NOTE: This manual was written in a graphics word processing system
  2. (Ami Pro 2.0).  This text file contains most of the text in the 
  3. manual, but the graphics are lost and the tables are not formated.
  4.  
  5. When you register, you can get a copy of the documentation for
  6. only $5 to cover the cost of printing and shipping. See INVOICE.DOC
  7. for details
  8. ---------------------------------------------------------------------
  9.  
  10. Introduction ..................................1 
  11. Abs ...........................................3 
  12. action ........................................3 
  13. adjustments ...................................4 
  14. continue ......................................5 
  15. Dec ...........................................5 
  16. DefCaveBlk ....................................6 
  17. DefLandBlk ....................................6 
  18. DefSpookBlk ...................................7 
  19. DefWaterBlk ...................................7 
  20. DefStat .......................................8 
  21. DefPack .......................................8 
  22. Copy ..........................................9 
  23. Display .......................................10 
  24. DoText ........................................12 
  25. Drop ..........................................13 
  26. EndGame .......................................14 
  27. Enter .........................................14 
  28. Failure .......................................14 
  29. Fight .........................................15 
  30. Fighting ......................................15 
  31. Find ..........................................16 
  32. For ...........................................17 
  33. Foreach .......................................18 
  34. Frame .........................................19 
  35. GetNum ........................................20 
  36. GetStr ........................................21 
  37. Goto ..........................................22 
  38. Gosub .........................................23 
  39. If ............................................24 
  40. Inc ...........................................25 
  41. Join ..........................................25 
  42. Leave .........................................26 
  43. LoadHint ......................................26 
  44. LoadText ......................................27 
  45. Locate ........................................27 
  46. Min, Max ......................................28 
  47. Move ..........................................29 
  48. Music .........................................30 
  49. On x Goto, On x Gosub .........................31 
  50. Paint .........................................32 
  51. Pause .........................................32 
  52. Random ........................................33 
  53. ReadText ......................................34 
  54. Restart .......................................35 
  55. Restore .......................................36 
  56. Return ........................................36 
  57. Save ..........................................37 
  58. Select ........................................38 
  59. SetBody .......................................41 
  60. SetBp .........................................41 
  61. Sign ..........................................42 
  62. Stats .........................................43 
  63. Stop ..........................................44 
  64. Success .......................................44 
  65. system ........................................45 
  66. Teleport ......................................46 
  67. Vanish ........................................47 
  68. Version .......................................47 
  69. ViewPcx .......................................48 
  70. Voice .........................................49 
  71. VPlay .........................................50 
  72. Wait ..........................................50 
  73. While .........................................51 
  74. Write[ln] .....................................52 
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.                                 D C  -  G A M E S 
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                                    Version 3.0
  92.  
  93.  
  94.  
  95.                         SCRIPT LANGUAGE REFERENCE GUIDE
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.                                 (c) DC Software, 1992
  110.                                 6705 Laramie Dr
  111.                                 Plano Tx 75023
  112.                                 (214)517-0428
  113. Introduction
  114.  
  115. Purpose
  116.  
  117. This manual presents all of the language commands and functions
  118. in alphabetical order and using a consistent presentation for
  119. all of them.  It is not intended to teach you how to write a
  120. script, but rather to describe in detail each and every command
  121. and function in the language.
  122.  
  123. The Script Language User's Guide is a more general document that
  124. tries to teach you how to write scripts.  That manual talks
  125. about the different types of scripts, the reasons for writing
  126. them, etc.  The examples in it include many different commands,
  127. since they try to show how to do something rather than teach you
  128. how many different things you can do with a single command.
  129.  
  130. The best way to use these manuals is to read the User's Guide
  131. from begining to end, and consult the Reference Guide only when
  132. you want to know more about a particular command or function.
  133.  
  134. If you are comfortable with programming languages, you can
  135. probably read this manual from side to side and end up knowing a
  136. lot about the script language itself, but you will NOT find out
  137. here the how, when or how of writing scripts.
  138.  
  139. Sincerely,
  140.  
  141.  
  142.  
  143. David A. Hernandez
  144. Abs
  145.  
  146. Syntax    ret-val = abs( expr );
  147.  
  148. Purpose    Returns the absolute value of the numeric expression.
  149.  
  150. Parameters    expr
  151.  
  152. Is an arithmetic expression.
  153.  
  154. Returns    The absolute value (positive number) of the expression.
  155.  
  156. Remarks    The absolute value of a number is the same number, but
  157. always with a positive sign.  Thus, abs(-2) is 2.
  158.  
  159. Example    ! Check to see if there is a great disparity between the
  160. character's 
  161.  
  162. ! experience and the npc's experience.
  163.  
  164. if abs( player.exp - npc.exp ) > 3 then
  165.  
  166.     writeln( "Perhaps another time.." );
  167.  
  168. else
  169.  
  170.     join; ! NPC joins the party..
  171.  
  172. endif;
  173.  
  174. See Also    min, max, random
  175.  
  176. action
  177.  
  178. Syntax    ret-val = action;
  179.  
  180. Purpose    Find out what action invoked the script.
  181.  
  182. Returns    The numeric action code which is actually the number of
  183. the entry point at which execution of the script will begin. 
  184. See Entry Points in the User's Guide for more information on
  185. these values.
  186.  
  187. Example    ! The following code handles both LOOK and EXAMINE, but
  188. EXAMINE
  189.  
  190. ! prints more detail than LOOK.
  191.  
  192. :LOOKING
  193.  
  194.     writeln("You see a ", object.name, ".  Type ", object.type );
  195.  
  196.     if action = EXAMINE then
  197.  
  198.         writeln( ", Class ", object.class, ", Weight: ", object.weight
  199. );
  200.  
  201.     endif;
  202.  
  203.     ...
  204.  
  205. adjustments
  206.  
  207. Syntax    ret-val = adjustments( expr1, ... );
  208.  
  209. Purpose    Compute the adjustments to character attributes
  210. indicated by the given set of values.
  211.  
  212. Parameters    exprN
  213.  
  214. Is one or more expressions separated by comma that result each
  215. in a number between 0 and 255.
  216.  
  217. Returns    The sum of the character attribute adjustments indicated
  218. by values of each of the expressions in it's arguments.
  219.  
  220. Remarks    During regular game play, a character's class determines
  221. such factors as the weight it can carry, the type of weapons
  222. and/or armor it can use, it's ability to strike moving targets,
  223. etc.
  224.  
  225.     In addition to the character class, it's standard attributes
  226. (such as strength, aim, dexterity, iq, etc.) may increase or
  227. decrease these factors.  For example, the stronger a character
  228. is, the more weight it can carry.
  229.  
  230.     The adjustments function  will compute the adjustments that
  231. should be made to any factor that depends on one or more of
  232. these attributes as follows:
  233.  
  234.     Value Range         Effect 
  235.  
  236. 0     8     Decrease by 1 point 
  237.  
  238. 9     15     No change 
  239.  
  240. 16     18     Increase by 1 point 
  241.  
  242. 19     20     Increase by 2 points 
  243.  
  244. 21     30     Increase by 3 points 
  245.  
  246. 31     40     Increase by 4 points (and so on..) 
  247.  
  248.  
  249.  
  250. Example    ! An ELF has a 1 in 4 chance to detect a trap, adjusted
  251. by it's dexterity and
  252.  
  253. ! intelligence.  All others have a 1 in 2 chance adjusted by
  254. dexterity.
  255.  
  256. if player.type = ELF then
  257.  
  258.     L28 = 4 + adjustments( player.dex, player.iq );
  259.  
  260. else
  261.  
  262.     L28 = 2 + adjustments( player.dex );
  263.  
  264. endif;
  265.  
  266. if random(L28) = 0 then ... trap activated ... else ... trap
  267. found ... endif;
  268.  
  269. continue
  270.  
  271. Syntax    continue;
  272.  
  273. Purpose    Terminate execution of the current script.
  274.  
  275. Remarks    This command informs the game driver that while the
  276. script has performed some actions, the DEFAULT action should
  277. still be taken, if any.
  278.  
  279. Warning    Because the OBJECT script contains the default action
  280. for objects, that script should never end with a continue. 
  281. Doing so would indicate that default action is needed, which may
  282. result in the object script being run twice for the same action.
  283.  
  284. See Also    stop, fight
  285.  
  286. Dec
  287.  
  288. Syntax    dec( variable [, expr]  )
  289.  
  290. Parameters    variable    is any numeric variable or attribute that
  291. can be modified from within a script.
  292.  
  293.     expr
  294.  
  295. is an optional expression that results in a number that will be
  296. substracted from the variable.  If omited, the default is 1.
  297.  
  298. Remarks    The decrement command will substract the amount
  299. indicated (1 if none is given) from the variable or attribute
  300. specified.  If the expression is negative, then the double
  301. substraction results in an addition.
  302.  
  303. Example    ! An NPC strikes the player
  304.  
  305. dec( player.hp, npc.weapon.damage );
  306.  
  307. DefCaveBlk
  308.  
  309. Syntax    ret-val = DefCaveBlk( which );
  310.  
  311. Purpose    Returns a graphics block number for cave and dungeon
  312. monsters. (Class CAVE_MONSTER)
  313.  
  314. Parameters    which
  315.  
  316. Identifies which of the five graphics blocks for random monsters
  317. you want.  The value must be between 0 and 4, with 0 being the
  318. smallest monster and 4 being the toughest.
  319.  
  320. Returns    ret-val
  321.  
  322. Is a graphics block record number (between 0 and 255) to be used
  323. for random monsters that are found in caves or dungeons.
  324.  
  325. Remarks    The DCWORLD parameter configuration screen is used to
  326. set the graphics blocks that will be used to generate random
  327. monsters.
  328.  
  329. See Also    DefLandBlk, DefWaterBlk, DefSpookBlk, DefStat, DefPack
  330.  
  331. DefLandBlk
  332.  
  333. Syntax    ret-val = DefLandBlk( which );
  334.  
  335. Purpose    Returns a graphics block number for outdoor, land based
  336. monsters. (Class LAND_MONSTER).
  337.  
  338. Parameters    which
  339.  
  340. Identifies which of the five graphics blocks for random monsters
  341. you want.  The value must be between 0 and 4, with 0 being the
  342. smallest monster and 4 being the toughest.
  343.  
  344. Returns    ret-val
  345.  
  346. Is a graphics block record number (between 0 and 255) to be used
  347. for random monsters that are land based.
  348.  
  349. Remarks    The DCWORLD parameter configuration screen is used to
  350. set the graphics blocks that will be used to generate random
  351. monsters.
  352.  
  353. See Also    DefCaveBlk, DefWaterBlk, DefSpookBlk, DefStat, DefPack
  354.  
  355. DefSpookBlk
  356.  
  357. Syntax    ret-val = DefSpookBlk( which );
  358.  
  359. Purpose    Returns a graphics block number for monsters that you
  360. might find in places like hounted houses or cementeries (Class
  361. SPOOK_MONSTER).
  362.  
  363. Parameters    which
  364.  
  365. Identifies which of the five graphics blocks for random monsters
  366. you want.  The value must be between 0 and 4, with 0 being the
  367. smallest monster and 4 being the toughest.
  368.  
  369. Returns    ret-val
  370.  
  371. Is a graphics block record number (between 0 and 255) to be used
  372. for random monsters of this type..
  373.  
  374. Remarks    The DCWORLD parameter configuration screen is used to
  375. set the graphics blocks that will be used to generate random
  376. monsters.
  377.  
  378. See Also    DefLandBlk, DefCaveBlk, DefWaterBlk, DefStat, DefPack
  379.  
  380. DefWaterBlk
  381.  
  382. Syntax    ret-val = DefWaterBlk( which );
  383.  
  384. Purpose    Returns a graphics block number for aquatic monsters
  385. (monsters that swim, class WATER_MONSTER).
  386.  
  387. Parameters    which
  388.  
  389. Identifies which of the five graphics blocks for random monsters
  390. you want.  The value must be between 0 and 4, with 0 being the
  391. smallest monster and 3 being the toughest.  Number 4 is used to
  392. represent a Pirate's Ship, which requires special handling to
  393. make sure a pirate's ship doesn't appear on a small pond of
  394. water in the middle of town!
  395.  
  396. Returns    ret-val
  397.  
  398. Is a graphics block record number (between 0 and 255) to be used
  399. for random monsters that are land based.
  400.  
  401. Remarks    The DCWORLD parameter configuration screen is used to
  402. set the graphics blocks that will be used to generate random
  403. monsters.
  404.  
  405. See Also    DefLandBlk, DefCaveBlk, DefSpookBlk, DefStat, DefPack
  406.  
  407. DefStat
  408.  
  409. Syntax    ret-val = DefStat( which );
  410.  
  411. Purpose    Returns an index into the statistics file (PLAYER.DTA)
  412. which holds the statistics that will be used for small, medium,
  413. large and pirate monsters.
  414.  
  415. Parameters    which
  416.  
  417. Is the size of the character you are creating.  0=Small,
  418. 1=Medium and 2=Large, 3=Pirates.
  419.  
  420. Returns    ret-val
  421.  
  422. Is the statistics record number (npc.stats) which holds the
  423. generic statistics for the size of character you indicated.
  424.  
  425. Remarks    The DCWORLD parameter configuration screen is used to
  426. set the 4 values that will be used as statistics records for
  427. random monsters.
  428.  
  429. See Also    DefLandBlk, DefCaveBlk, DefSpookBlk, DefPack
  430.  
  431. DefPack
  432.  
  433. Syntax    ret-val = DefPack( which );
  434.  
  435. Purpose    Returns an index into the statistics file (PLAYER.DTA)
  436. which holds the statistics record whose backpack contains the
  437. items that will be used to generate random treasure.
  438.  
  439. Parameters    which
  440.  
  441. Is which of the 3 backpacks should be used (0, 1 or 2).
  442.  
  443. Returns    ret-val
  444.  
  445. Is the statistics record number (npc.stats) whose backpack
  446. contains items to be used for random treasure.
  447.  
  448. Remarks    The DCWORLD parameter configuration screen is used to
  449. select the statistics records to be used.  The statistics screen
  450. is used to modify the records themselves.  The default records
  451. contain Potions, Rings & Amulets, and Magic Staffs respectively.
  452.  
  453. See Also    DefLandBlk, DefCaveBlk, DefSpookBlk, DefStat
  454.  
  455. Copy
  456.  
  457. Syntax    copy( source, destination [, count] );
  458.  
  459. Purpose    To create a copy of an object and place it in a given
  460. location.
  461.  
  462. Parameters    source
  463.  
  464. The copy command can copy an object from curritem, object,
  465. group.vehicle, npc.bp, npc.body, npc.weapon, npc.armor,
  466. npc.shield, npc.ring, npc.amulet, npc.staff, player.bp,
  467. player.body, player.weapon, player.armor, player.shield,
  468. player.ring, player.amulet and player.staff.
  469.  
  470.     destination
  471.  
  472. The destination can be any of the above, except for the generic
  473. locations curritem and object.
  474.  
  475.     count
  476.  
  477. This is the number of copies of the object that are placed at
  478. the destination.  It is an expression that results in a value
  479. between 1 and 255.  If omited, the default is the number of
  480. copies in the source.
  481.  
  482. Remarks    The destination must be appropriate to the type of
  483. object, for example, you can't move an object of type amulet to
  484. player.shield.
  485.  
  486.     When an object is copied or moved to the generic destination
  487. .body, it will be placed in the correct body section according
  488. to the object's type.
  489.  
  490.     When the count is greater than one, copies are moved one by
  491. one.  The character's load is checked before each move to verify
  492. that the character can carry the object.  If the character's
  493. maximum load is reached before all objects have been copied, the
  494. failure variable is set to the actual number of copies moved.
  495.  
  496. Examples    ! Copy 5 instances of an object from npc.bp to player.bp
  497.  
  498. copy( npc.bp, player.bp, 5 );
  499.  
  500. if failure then
  501.  
  502.   L6 = failure;
  503.  
  504.   writeln( player.name, " could only carry ", L6 );
  505.  
  506.   drop( npc.bp, - L6 ); ! Place the rest on the floor.. !
  507.  
  508. endif;
  509.  
  510. See Also    move, failure, drop
  511.  
  512. Display
  513.  
  514. Syntax    display ( group );1
  515.  
  516. display [$[2]] ( {player|npc}  [, {matching|type}] );2
  517.  
  518. display [$[2]] ( {player.body|npc.body} );3
  519.  
  520. display [$] (  string [, value] [, string ... ] );4
  521.  
  522. Purpose    Display a list of characters, items, etc, on the menu
  523. area.
  524.  
  525. Parameters    group, player, npc, player.body and npc.body
  526.  
  527. Identify what you want to display in the menu area.
  528.  
  529.     matching
  530.  
  531. Used to indicate that only items that match the items of the
  532. type carried by the current npc should be displayed.  (Used by
  533. merchants)
  534.  
  535.     type    
  536.  
  537. is a number between 0 and 255 (tokens may be used). 
  538.  
  539.     string
  540.  
  541. is a text string enclosed in quotes.
  542.  
  543.     value
  544.  
  545. is either a number (constant or token) or a single variable or
  546. attribute whose value is numeric.  No arithmetic expressions are
  547. permited.
  548.  
  549. Remarks    The display command is a powerful tool to display a list
  550. of values in the menu area of the screen.  If a $ is specified,
  551. then values will be displayed as gold or silver pieces (1gp =
  552. 10sp).  The 2 following the $ 
  553.  
  554. indicates that the values should be divided by 2 before being
  555. displayed.
  556.  
  557.  
  558.  
  559. 1) Displays the current members of the playing party
  560.  
  561. 2) Displays the contents of a character's backpack. If matching
  562. is specified, it indicates that only items that match the types
  563. of items in the current npc's  backpack should be displayed. If
  564. type is provided, only items of the specified type are displayed.
  565.  
  566. 3) Displays the set of items being worn by a character (weapon,
  567. armor, shield, amulet, ring and staff).
  568.  
  569. 4) Displays a list of strings with or without values associated
  570. with it.
  571.  
  572. Examples    ! Display the current members
  573.  
  574. display( group );
  575.  
  576.  
  577.  
  578. ! Display the current player's inventory
  579.  
  580. display( player );
  581.  
  582.  
  583.  
  584. ! Display a merchant's inventory (with prices)
  585.  
  586. display$( npc );
  587.  
  588.  
  589.  
  590. ! Display the player's items that the merchant might want to
  591. buy..
  592.  
  593. display$2( player, matching );
  594.  
  595.  
  596.  
  597. ! Display a list of items and a price (numbers in silver pieces)
  598.  
  599. display$( "Magic Ring", 300, "Short Sword", 150, "Banana", 1 );
  600.  
  601.  
  602.  
  603. ! Display a list with numbers (not $)
  604.  
  605. display( "Age", 27, "Strength", npc.str, "Max Weight",
  606. npc.mload);
  607.  
  608. See Also    select
  609.  
  610. DoText
  611.  
  612. Syntax    ret-val = dotext( str-val );
  613.  
  614. Purpose    To perform keyword analysis compatible with pervious
  615. prior versions of the DCGAMES system.
  616.  
  617. Parameters    str-val
  618.  
  619. Is either a word surrounded by double quotes (string constant),
  620. or the string variable S0.
  621.  
  622. Returns    ret-val
  623.  
  624. Returns the index of the keyword in the text record (1-16) if
  625. found, 0 if not found.
  626.  
  627. Remarks    This compares the keyword str-val against the first 8
  628. characters of the string variables S1 through S16.  If a match
  629. is found, then the text found in the variable that had the
  630. matching keyword (minus the keyword) is displayed on the screen
  631. and the number (1-16) of the string that had the match is
  632. returned.  Otherwise, a 0 is returned and no message is
  633. displayed.
  634.  
  635.     If a SoundBlaster card is present, and the current character or
  636. object being processed has a voice file associated with it
  637. (voice attribute), then the voice file (VOICE###.VFL, where ###
  638. is the value of the voice attribute), is searched for the same
  639. keyword, and if present, the corresponding recorded voice is
  640. played.
  641.  
  642.     If the voice file is not present or the keyword is not found in
  643. the voice file, but the SBTALKER text-to-speach translator is
  644. present (memory resident), then the text that followed the
  645. keyword will be spoken in addition to being displayed.    
  646.  
  647. Example    ! Talk to the player..
  648.  
  649. :TALKHERE
  650.  
  651. L9 = getstr( "Hello", "King", "Queen", "Treasure", "Key", "Door"
  652. );
  653.  
  654. if NOT dotext( s0 ) then   ! The text record didn't handle the
  655. keyword..
  656.  
  657.     on L9 gosub XHELLO, XKING, XQUEEN, XGOLD, XKEY, XDOOR;
  658.  
  659. endif;
  660.  
  661. if S0 <> "Bye" goto TALKHERE;
  662.  
  663. stop;
  664.  
  665. See Also    voice, vplay, write, writeln
  666.  
  667. Drop
  668.  
  669. Syntax    drop( item [, howmany [, x [, y]]]  );
  670.  
  671. Purpose    Get rid of an item that a character is carrying or
  672. riding.
  673.  
  674. Parameters    item
  675.  
  676. Is the item to be dropped, which must be one of: group.vehicle,
  677. curritem, player.bp, player.body, player.weapon, player.armor,
  678. player.shield, player.ring, player.amulet, player.staff, npc.bp,
  679. npc.body, etc.
  680.  
  681.     howmany
  682.  
  683. Is the number of items to be dropped.  0 means all. A negative
  684. means that the objects are not to be removed, but rather
  685. duplicated. The default value is 1.
  686.  
  687.     x, y
  688.  
  689. Is the location in the world where the object will be placed. 
  690. The default values are the current player's location.
  691.  
  692. Remarks    The item will be added to the world's list of objects
  693. with a count attribute as indicated by the howmany parameter.
  694.  
  695.     If the howmany parameter is 0, the current count attribute of
  696. the item being dropped is used.
  697.  
  698.     If the howmany parameter is negative,  it indicates that a copy
  699. should be made of the items.  The originals are left intact.
  700.  
  701.     If the absolute value of the howmany parameter is greater than
  702. the count attribute of the item, then howmany is used.  (i.e.,
  703. you end up with more copies than you had!).
  704.  
  705. Examples    ! The following are all equivalent
  706.  
  707. drop( curritem );    ! If the current item is the current backpack
  708. item
  709.  
  710. drop( player.bp );
  711.  
  712. drop( player.bp, 1 );
  713.  
  714. drop( player.bp, 1, player.x, player.y );
  715.  
  716.  
  717.  
  718. ! If the npc has a weapon, drop it one square to the right of
  719. the player
  720.  
  721. if npc.weapon.count then
  722.  
  723.   drop( npc.weapon, npc.count, player.x+1, player.y );
  724.  
  725. endif;
  726.  
  727. EndGame
  728.  
  729. Syntax    endgame;
  730.  
  731. Purpose    Terminate the game.  You have either won or lost, but
  732. you cannot continue.
  733.  
  734. Remarks    The game displays the copyright screen and returns the
  735. user to DOS.  The assumption is that an appropriate ending
  736. scenario has been executed by the script.
  737.  
  738. Enter
  739.  
  740. Syntax    enter( door# );
  741.  
  742. Purpose    Send the playing party through a specific door, wherever
  743. it might lead.
  744.  
  745. Parameters    door#
  746.  
  747. A numeric expression that indicates which door should in the
  748. current world you want to take.
  749.  
  750. Remarks    The transfer through the door does not take place until
  751. after the script ends execution. You still need to use the stop
  752. or continue option to end the script.
  753.  
  754. Failure
  755.  
  756. Syntax    ret-val = failure;
  757.  
  758. Purpose    To find out if the last major operation failed.
  759.  
  760. Returns    ret-val
  761.  
  762. The returns will be non-zero (TRUE) if the last major operation
  763. failed to complete successfuly.
  764.  
  765. Example    ! A merchant sells an item to a player..
  766.  
  767. writeln( "Here is your ", npc.bp.name );
  768.  
  769. copy( npc.bp, player.bp );
  770.  
  771. if failure then
  772.  
  773.     writeln( "The ", npc.bp.name, " is placed on the floor.." );
  774.  
  775.     drop( npc.bp );
  776.  
  777. endif;
  778.  
  779. See Also     success
  780.  
  781. Fight
  782.  
  783. Syntax    fight;
  784.  
  785. Purpose    Go into fighting mode against the currently selected npc
  786. character.
  787.  
  788. Remarks    The type of the npc does not have to be HOSTILE. The
  789. fight may be against any character of any type.
  790.  
  791.     The script is immediatly ended and the fight starts right away.
  792.  No stop or continue command is needed.
  793.  
  794. Warning    Do not use fight after you have done enter.  The fight
  795. takes place before the transfer is made, but the scripts that
  796. execute during and immediately after the fight may get confused.
  797.  The desired behaviour for this situation is yet to be
  798. determined..
  799.  
  800. See Also    fighting
  801.  
  802. Fighting
  803.  
  804. Syntax    ret-val = fighting;
  805.  
  806. Purpose    To find out if the script is executing during a fight.
  807.  
  808. Returns    ret-val
  809.  
  810. A non-zero value (TRUE) is returned when a fight is taking place.
  811.  
  812. Remarks    Your script may behave differently depending on whether
  813. you are in a fight or not.  For example, certain spells may not
  814. work during a fight.
  815.  
  816.     During a fight, the party and the npc are separated into their
  817. respective individuals, and all other characters are removed
  818. from the screen.
  819.  
  820.     The party may not leave the area during a fight, but pressing
  821. the ESC key will exit fighting mode and allow the party to
  822. attempt to out-run the enemy.
  823.  
  824. See Also    fight
  825.  
  826. Find
  827.  
  828. Syntax    retval = find( where [, what [, type]] );
  829.  
  830. Purpose    Find an object or character.
  831.  
  832. Parameters    where
  833.  
  834. Identifies where you want to search for the object.  It can be
  835. one of group, object, npc, player, npc.bp, player.bp, npc.body
  836. or player.body.
  837.  
  838.     what
  839.  
  840. Is the name of the item or person you are looking for.  It must
  841. either be a string constant ("like this") or a string attribute
  842. of a character or object.
  843.  
  844.     type
  845.  
  846. If present, it indicates that the item must not only have the
  847. given name, but must also have the given type attribute.  The
  848. value is either a numeric constant, a numeric token or the type
  849. attribute of a character or object.
  850.  
  851. Returns    The index attribute of the item (starts with 0), or
  852. negative if the item was not found.
  853.  
  854. Remarks    When group is searched, what is a character name, and
  855. success indicates that the character is a member of the group.
  856.  
  857.     When object is searched, the current world is searched for an
  858. object with the given name (and type, if given).
  859.  
  860.     When npc is searched, the current world is searched for an
  861. object with the given name (and type, if given).
  862.  
  863.     When player is given, the backpacks of every player in the
  864. current group is searched for the given object.  The value
  865. returned is the index of the player carrying the object, not the
  866. index of the object in the backpack.
  867.  
  868.     When npc.bp or player.bp is specified, the backpack of the
  869. character is searched for the given object.
  870.  
  871.     When npc.body or player.body is specified, the items currently
  872. worn by the character are searched (weapon, armor, shield, ring,
  873. amulet and staff).
  874.  
  875. For
  876.  
  877. Syntax    for localvar = expr1 to expr2 [by value] do statements;
  878. endfor;
  879.  
  880. Purpose    Execute a set of statements a given number of times.
  881.  
  882. Parameters    localvar
  883.  
  884. Is a local variable which will be used to hold the loop's
  885. current value.
  886.  
  887.     expr1
  888.  
  889. Is the initial value that will be assigned to the local variable.
  890.  
  891.     expr2
  892.  
  893. Is an expression against which the local variable is compared to
  894. determine if the statements should be executed or if the loop
  895. has ended.
  896.  
  897.     value
  898.  
  899. Is a numeric constant (may be negative) which is added to the
  900. local variable at the end of every iteration (after the
  901. statements are executed).
  902.  
  903. Remarks    Note that expr1 is evaluated once, at the begining of
  904. the loop, but expr2 is evaluated every time after the value has
  905. been added to localvar. The statements between the do and endfor
  906. keywords will be executed again and again until local variable's
  907. value becomes greater (or less if the value is negative) than
  908. expr2.
  909.  
  910. Examples    ! Drop all the weapons of all the player's in the group
  911.  
  912. for L7 = 0 to group.size do
  913.  
  914.     group.current = L0;
  915.  
  916.     if player.weapon.count then
  917.  
  918.        drop(player.weapon);
  919.  
  920.     endif;
  921.  
  922. endfor;
  923.  
  924.     ! Search the npc's backpack for an object (in reverse, to make
  925. it fun).
  926.  
  927. for L0 = 15 to 0 by -1 do
  928.  
  929.     setbp( npc, L0 );
  930.  
  931.     if npc.bp.count > 0 and npc.bp.name = "The Thing" then
  932.  
  933.        writeln( "I found it!" );
  934.  
  935.     endif;
  936.  
  937. endfor;
  938.  
  939. if L0 < 0 then writeln( "Didn't find it!" ); endif;
  940.  
  941.  
  942.  
  943. Foreach
  944.  
  945. Syntax    foreach item do statements; endfor;
  946.  
  947. Purpose    Allow you to process all players, npcs or objects, in
  948. order.
  949.  
  950. Parameters    item
  951.  
  952. Is one of player, npc or object.
  953.  
  954. Remarks    If the item is player, then the player variable will be
  955. set to each of the members of the group, consecutively.
  956.  
  957.     If the item is npc,  then the npc variable will be set to every
  958. character in the current world, consecutively.
  959.  
  960.     If the item is object, then the object variable will be set to
  961. each of the objects in the current world, consecutively.
  962.  
  963. Examples    ! Drop the weapons carried by every member of the group
  964.  
  965. foreach player do
  966.  
  967.    if player.weapon.count then
  968.  
  969.         drop( player.weapon );
  970.  
  971.    endif;
  972.  
  973. endif;
  974.  
  975.     ! Check to see if there is a character named 'Morris' in this
  976. world.
  977.  
  978. ! (Could have used the find command)
  979.  
  980. foreach npc do
  981.  
  982.     if npc.name = "Morris" then
  983.  
  984.        writeln( "Found Him!" );
  985.  
  986.     endif;
  987.  
  988. endfor;
  989.  
  990.     ! Find out if there is any object at a specific location in the
  991. world
  992.  
  993. foreach object do
  994.  
  995.     if object.x = 30 and object.y = 23 then
  996.  
  997.         writeln("Object ", object.name, " is on the hot spot.."
  998. );
  999.  
  1000.     endif;
  1001.  
  1002. endfor;
  1003.  
  1004. Frame
  1005.  
  1006. Syntax    frame( x, y, block# );
  1007.  
  1008. Purpose    Display a system graphics block over the current
  1009. graphics block at the x and y location within the current world.
  1010.  
  1011. Parameters    x
  1012.  
  1013. Is the horizontal position for the frame.  May be an expression.
  1014.  
  1015.     y
  1016.  
  1017. Is the vertical position for the frame. May be an expression.
  1018.  
  1019.     block#
  1020.  
  1021. Is the graphics block record number from the system graphics
  1022. file which contains the frame you wish to display.
  1023.  
  1024. Remarks    If the x, y position is not on the screen, the frame is
  1025. not shown.
  1026.  
  1027.     The frame is X-ORed (over-imposed) on top of the graphics at
  1028. the given location.  To remove the frame, you re-display the
  1029. frame at the same location.
  1030.  
  1031. Example    ! Draw a SPLAT type frame on top of the group to
  1032. indicate they have
  1033.  
  1034. ! been hit by something (i.e. the members suffered some damage)
  1035.  
  1036. frame( group.x, group.y, SYS_SPLAT );
  1037.  
  1038. wait(1);
  1039.  
  1040. frame( group.x, group.y, SYS_SPLAT );
  1041.  
  1042.     ! Draw a bullet being shot from the current player to an npc.
  1043.  
  1044. ! (This algorithm doesn't really work very well.  It is just an
  1045. example)
  1046.  
  1047. if player.x < npc.x then L0 = 1; else L0 = -1; endif;
  1048.  
  1049. if player.y < npc.y then L1 = 1; else L1 = -1; endif;
  1050.  
  1051. for L3 = player.x to npc.x by L0 do
  1052.  
  1053.     for L4 = player.y to npc.y by L1 do
  1054.  
  1055.         frame( L3, L4, SYS_BULLET );
  1056.  
  1057.         wait(1);
  1058.  
  1059.         frame(L3, L4, SYS_BULLET );
  1060.  
  1061.     endfor;
  1062.  
  1063. endfor;
  1064.  
  1065. GetNum
  1066.  
  1067. Syntax    retval = getnum( string [, low [, high] ] );
  1068.  
  1069. Purpose    This function displays a message and asks the user to
  1070. enter a numeric value between low and high inclusive.  The value
  1071. that the user types is returned as the function's value.
  1072.  
  1073. Parameters    string
  1074.  
  1075. Is a string to be displayed in the text area of the game screen,
  1076. before the user is asked to enter a number.
  1077.  
  1078.     low
  1079.  
  1080. Is the minimum allowed value.  It may be an expression.  The
  1081. default is 0.
  1082.  
  1083.     high
  1084.  
  1085. Is the maximum allowed value.  It may be an expression. The
  1086. default value is 32767.
  1087.  
  1088. Returns    This function returns a number between low and high as
  1089. typed by the game player, or -1 if the game player pressed the
  1090. ESCape key.
  1091.  
  1092. Remarks    The low and high values must be between 0 and 32767
  1093. inclusive. If low is higher than high, their values are reversed.
  1094.  
  1095. Example    ! Drop some (or all) of a certain object
  1096.  
  1097. L6 = getnum( "Drop how many", 0, player.bp.count );
  1098.  
  1099. if L6 > 0 then
  1100.  
  1101.     drop( player.bp.count, L6 );
  1102.  
  1103. endif;
  1104.  
  1105.  
  1106.  
  1107. GetStr
  1108.  
  1109. Syntax    retval = getstr( "string" [, "string"] ... );
  1110.  
  1111. Purpose    Asks the user to type in something (a word), then
  1112. compares the keyword entered with the list of strings and
  1113. returns the numeric index of the string that matches (if any).
  1114.  
  1115. Parameters    string 
  1116.  
  1117. Is a single word enclosed in double quotes.
  1118.  
  1119. Returns    The getstr command will compare the keyword typed by the
  1120. player and return the position (starting with 0) of that keyword
  1121. in the list.
  1122.  
  1123.     If no match is found, a -1 is returned.
  1124.  
  1125. Remarks    You can list up to 255 strings may be listed.
  1126.  
  1127.     Only the first 8 characters of the string are compared. The
  1128. rest are discarded.
  1129.  
  1130.     The comparison is case insensitive (i.e. "Hello" is equal to
  1131. "HELLO").
  1132.  
  1133. Examples    ! Everyone died, so...
  1134.  
  1135. writeln( "What do you want to do (Restore, Restart, Quit)" );
  1136.  
  1137. L3 = getstr( "Restore", "Restart", "Quit");
  1138.  
  1139. if L3 = 0 then
  1140.  
  1141.     ...
  1142.  
  1143. elsif L3 = 1 then
  1144.  
  1145.     ...
  1146.  
  1147. else
  1148.  
  1149.     endgame;
  1150.  
  1151. endif;
  1152.  
  1153. See Also     select, on x goto
  1154.  
  1155. Goto
  1156.  
  1157. Syntax    goto LABEL;
  1158.  
  1159. Purpose    Within the script, transfer the execution to the
  1160. indicated label.
  1161.  
  1162. Remarks    The LABEL must be defined elsewhere in the script as
  1163. follows
  1164.  
  1165.         :LABEL
  1166.  
  1167.     Execution of the script continues on the first statement after
  1168. the indicated label.
  1169.  
  1170. Example    ! Transfer execution 
  1171.  
  1172. goto SKIP;
  1173.  
  1174. writeln( "You should NOT see this line" );
  1175.  
  1176.     :SKIP
  1177.  
  1178. writeln( "You should see this one instead" );
  1179.  
  1180. See Also    on x goto, if expr goto, gosub, on x gosub and if expr
  1181. gosub
  1182.  
  1183. Gosub
  1184.  
  1185. Syntax    gosub LABEL;
  1186.  
  1187. Purpose    Within the script, transfer the execution to the
  1188. indicated label.
  1189.  
  1190. Remarks    The LABEL must be defined elsewhere in the script as
  1191. follows
  1192.  
  1193.         :LABEL
  1194.  
  1195.     Execution of the script continues on the first statement after
  1196. the indicated label.
  1197.  
  1198.     When the return statement is found, execution returns to the
  1199. first statement after the gosub statement.
  1200.  
  1201.     This statement is used to perform a series of statements at
  1202. many different points within the same script.
  1203.  
  1204. Example    ! Transfer execution 
  1205.  
  1206. gosub SKIP;
  1207.  
  1208. writeln( "You should see this message SECOND" );
  1209.  
  1210. stop;
  1211.  
  1212.  
  1213.  
  1214. :SKIP
  1215.  
  1216. writeln( "You should see this message FIRST!" );
  1217.  
  1218. return;
  1219.  
  1220. writeln( "You should NOT see this message at all" );
  1221.  
  1222. See Also    return, on x gosub and if expr gosub
  1223.  
  1224. If
  1225.  
  1226. Syntax    if expr1 then statements1;
  1227.  
  1228. [elsif expr2 then statements2; ...]
  1229.  
  1230. [else statements3;]
  1231.  
  1232. endif;
  1233.  
  1234.     or
  1235.  
  1236.     if expr1 goto label;
  1237.  
  1238.     or
  1239.  
  1240.     if expr1 gosub label;
  1241.  
  1242. Purpose    Execute a group of statements only if the expresion expr
  1243. is true.
  1244.  
  1245. Parameters    expr1, expr2, ...
  1246.  
  1247. These are logical expressions which evaluate to a True or False
  1248. value.  True is any non-zero value.  False is zero.
  1249.  
  1250.     statements1, statements2, ...
  1251.  
  1252. These are the statements to be executed the related expression
  1253. is true.
  1254.  
  1255.     statments3
  1256.  
  1257. These are the statements to be executed if NONE of the given
  1258. expressions are true (i.e. they are all false).
  1259.  
  1260. Remarks    In the second and third form, the goto or gosub are
  1261. executed only if the expression expr1 evaluates to a non-zero
  1262. value.
  1263.  
  1264. Examples    ! Drop the current player's weapon
  1265.  
  1266. if player.weapon.count > 0 then
  1267.  
  1268.     drop( player.weapon );
  1269.  
  1270. else
  1271.  
  1272.     writeln( "You are not wielding a weapon" );
  1273.  
  1274. endif;
  1275.  
  1276. Inc
  1277.  
  1278. Syntax    inc( variable [, expr]  )
  1279.  
  1280. Parameters    variable    is any numeric variable or attribute that
  1281. can be modified from within a script.
  1282.  
  1283.     expr
  1284.  
  1285. is an optional expression that results in a number that will be
  1286. added to the variable.  If omited, the default is 1.
  1287.  
  1288. Remarks    The increment command will add the amount indicated (1
  1289. if none is given) to the variable or attribute specified.  If
  1290. the expression is negative, the effect will be to decrement the
  1291. value.
  1292.  
  1293. Example    ! An player drinked some healing potion, so restore some
  1294. points..
  1295.  
  1296. inc( player.hp, curritem.units );
  1297.  
  1298. Join
  1299.  
  1300. Syntax    join;
  1301.  
  1302. Purpose    Cause the npc character to join the current party.
  1303.  
  1304. Remarks    The current npc is removed from the world in which it
  1305. exists and added to the player's party.
  1306.  
  1307.     The npc variable is cleared (i.e. no npc is selected any
  1308. longer).
  1309.  
  1310.     The party can hold a maximum of 6 players. If the party is
  1311. full, the npc will NOT join the party.
  1312.  
  1313. Leave
  1314.  
  1315. Syntax    leave( whom );
  1316.  
  1317. Purpose    Cause a player to leave the party.
  1318.  
  1319. Remarks    The player with index whom in the group will leave the
  1320. party.
  1321.  
  1322.     Note that the main player (index 0 is not allowed to leave the
  1323. party.
  1324.  
  1325.     Note also that the player's script is NOT invoked to give it a
  1326. chance to refuse to leave.  This is in contrast to the game
  1327. driver's V)acate command (player pressed letter V), which
  1328. invokes the player's script, and if the script either does not
  1329. handle the action, or terminates with continue, then invokes the
  1330. CONTROL script which in turn executes the a leave command.
  1331.  
  1332. Example    ! When the party enters the King's Castle, if the king
  1333. is a member of the
  1334.  
  1335. ! party it means that the King has been rescued and now should
  1336. leave the
  1337.  
  1338. ! party and go sit with the queen..
  1339.  
  1340. if world.name = "King's Castle" then
  1341.  
  1342.    L0 = find( group, "The King" );
  1343.  
  1344.    if L0 > 0 then                                   ! Found the
  1345. king
  1346.  
  1347.        writeln( "The king leaves you and heads for the throne
  1348. room.." );
  1349.  
  1350.        L1 = find( npc, "The Queen" );   ! Find out where the
  1351. Queen is
  1352.  
  1353.        npc.index = L1;                           ! Select her as
  1354. current npc.
  1355.  
  1356.        leave( L0, npc.x+1, npc.y );        ! Place the king next
  1357. to the queen. 
  1358.  
  1359.    endif;
  1360.  
  1361. endif;
  1362.  
  1363. LoadHint
  1364.  
  1365. Syntax    loadhint;
  1366.  
  1367. Purpose    Load a one-line 'hint' from the hint file (HINT.DTA).
  1368.  
  1369. Remarks    Hints are placed in the HINT.DTA file using the DCWORLD
  1370. game builder.
  1371.  
  1372.     The hint is selected at random and placed in variable S0.
  1373.  
  1374. Example    ! Display a hint
  1375.  
  1376. loadhint;
  1377.  
  1378. writeln( "The beggar gives you a hint:", S0 );
  1379.  
  1380. LoadText
  1381.  
  1382. Syntax    loadtext( text-record-# );
  1383.  
  1384. Purpose    To load a text record (16 lines of text) from the
  1385. TEXT.DTA file into the 16 string variables S1 through S16.
  1386.  
  1387. Remarks    The text-record-# is an expression that evaluates to a
  1388. number between 0 and the number of text records in the TEXT.DTA
  1389. file (minus one).
  1390.  
  1391.     The given record is loaded into the S1 through S16 (not S0).
  1392.  
  1393. See Also    dotext
  1394.  
  1395. Locate
  1396.  
  1397. Syntax    ret-val = locate [ ( object|npc ) ] ;
  1398.  
  1399. Purpose    To allow the player to point on the screen to an object
  1400. or character, which becomes the current object or npc.
  1401.  
  1402. Remarks    If the parameter is omited, the player is allowed to
  1403. point to either an object or a character.  If it is given, then
  1404. the player must point to an object or an npc depending on the
  1405. parameter that was specified.
  1406.  
  1407.     The returns is the distance (in squares) from the selected
  1408. object or npc, or -1 if non was selected.
  1409.  
  1410. Min, Max
  1411.  
  1412. Syntax    ret-val = min( expr  [, expr ...] );  or
  1413.  
  1414. ret-val = max( expr [, expr ...] );
  1415.  
  1416. Purpose    To obtain the smallest (or largest) of a set of values.
  1417.  
  1418. Parameters    expr
  1419.  
  1420. Two or more arithmetic expressions separated by commas.  A
  1421. maximum of 255 expressions are allowed.
  1422.  
  1423. Examples    ! Look for the object with the highest weight in the
  1424. player's backpack
  1425.  
  1426. L0 = -1;
  1427.  
  1428. foreach player.bp do
  1429.  
  1430.     L0 = max( L0, player.bp.weight );
  1431.  
  1432. endfor;
  1433.  
  1434. if L0 > 0 then
  1435.  
  1436.   writeln( "The heavyest object has a weight of  ", L0, "lbs" );
  1437.  
  1438. endif;
  1439.  
  1440. Move
  1441.  
  1442. Syntax    move( source, destination [, count] );
  1443.  
  1444. Purpose    To create a copy of an object and place it in a given
  1445. location.
  1446.  
  1447. Parameters    source
  1448.  
  1449. The move command can move an object from curritem, object,
  1450. group.vehicle, npc.bp, npc.body, npc.weapon, npc.armor,
  1451. npc.shield, npc.ring, npc.amulet, npc.staff, player.bp,
  1452. player.body, player.weapon, player.armor, player.shield,
  1453. player.ring, player.amulet and player.staff.
  1454.  
  1455.     destination
  1456.  
  1457. The destination can be any of the above, except for the generic
  1458. locations curritem and object.
  1459.  
  1460.     count
  1461.  
  1462. This is the number of copies of the object to be moved.  It must
  1463. be a value between 1 and the actual number of copies (.count
  1464. attribute).
  1465.  
  1466. Remarks    The destination must be appropriate to the type of
  1467. object, for example, you can't move an object of type amulet to
  1468. player.shield.
  1469.  
  1470.     When an object is copied or moved to the generic destination
  1471. .body, it will be placed in the correct body section according
  1472. to the object's type.
  1473.  
  1474.     If there is no space to put the object in the destination, the
  1475. operation fails, and the number of objects that were actually
  1476. moved is stored in the failure variable.
  1477.  
  1478.       The backpack can hold 16 items.  Each body part can hold only
  1479. one item.
  1480.  
  1481. See Also    copy, drop, vanish, failure
  1482.  
  1483. Music
  1484.  
  1485. Syntax    music( filename );
  1486.  
  1487. Purpose    Starts playing a CMF music file using the Sound Blaster
  1488. music driver SBFMDRV. 
  1489.  
  1490. Parameters    The name of the music file.  The filename is a legal
  1491. DOS filename, and may include a disk drive and path
  1492. specification.  Up to 64 characters long.
  1493.  
  1494. Remarks    The filename must be a string constant (surrounded by
  1495. double quotes).
  1496.  
  1497.     To enable music, you must have a Sound Blaster card and you
  1498. must load the memory resident driver SBFMDRV. Consult your Sound
  1499. Blaster owner's manual for more informatino on SBFMDRV.
  1500.  
  1501.     NOTE: I do not have a program for creating CMF music files. 
  1502. The Sound Blaster card I purchased did not include one either,
  1503. but I have a basic model and the newer models may include one.
  1504.  
  1505.     I do have access to some shareware and/or public domain
  1506. programs that can translate ROLAND music files (ROL format) into
  1507. CMF files, and a few other similar utilities.  If you have or
  1508. know of any shareware or public domain utilities to create music
  1509. in CMF format I would appreciate a call.
  1510.  
  1511. Examples    ! Play some music and wait until either the music ends, 
  1512.  
  1513. ! the player presses a key or 2 minutes have elapsed.
  1514.  
  1515. music( "Intro.cmf" );
  1516.  
  1517. wait( 180 );
  1518.  
  1519.     ! Play some music in the background, display a picture and then 
  1520.  
  1521. ! Wait for 2 minutes or until the player presses a key, even if
  1522. the 
  1523.  
  1524. ! music ends.
  1525.  
  1526. music( "c:/game/sound/mymusic.cmf");
  1527.  
  1528. pause( 180 );
  1529.  
  1530. On x Goto, On x Gosub
  1531.  
  1532. Syntax    on expr {goto|gosub} label0, label1, label2, ... labeln;
  1533.  
  1534. Purpose    To support the transfer of control to one of a set of
  1535. labels depending on the value of an expression.
  1536.  
  1537. Parameters    expr
  1538.  
  1539. This expression evaluates to a number between 0 and n.
  1540.  
  1541.     label0, label1, ..
  1542.  
  1543. These are the labels that have been declared elsewhere in the
  1544. script to receive control of execution.
  1545.  
  1546. Remarks    The difference between goto and gosub is that the return
  1547. statement will return execution to the statement following the
  1548. on statement..
  1549.  
  1550.     If the expression has a negative value or a value greater than
  1551. n, no transfer takes place, and execution continues on the
  1552. statement following the on statement.
  1553.  
  1554. Example    ! Talk to the player..
  1555.  
  1556. :TALKHERE
  1557.  
  1558. L9 = getstr( "Hello", "King", "Queen", "Treasure", "Key", "Door"
  1559. );
  1560.  
  1561. loadtext( player.text );
  1562.  
  1563. if NOT dotext( s0 ) then   ! The text record didn't handle the
  1564. keyword..
  1565.  
  1566.     on L9 gosub XHELLO, XKING, XQUEEN, XGOLD, XKEY, XDOOR;
  1567.  
  1568. endif;
  1569.  
  1570. if S0 <> "Bye" goto TALKHERE;
  1571.  
  1572. stop;
  1573.  
  1574. See Also     goto, gosub, if x goto, if x gosub, return
  1575.  
  1576. Paint
  1577.  
  1578. Syntax    paint( { screen | window } );
  1579.  
  1580. Purpose    To re-paint either the entire screen or just the game
  1581. playing window because the script has performed some actions
  1582. that have probably erased all or part of the window.
  1583.  
  1584. Remarks    This statement is useful when you move the player of the
  1585. screen by modifying it's x and y attributes.
  1586.  
  1587.     It is also a good idea after running a DOS program, or after
  1588. you display a PCX graphics file on the screen.
  1589.  
  1590. See Also    viewpcx
  1591.  
  1592. Pause
  1593.  
  1594. Syntax    pause( time );
  1595.  
  1596. Purpose    Pauses script execution until the user presses the space
  1597. key or the specified time has elapsed.
  1598.  
  1599. Parameters    time
  1600.  
  1601. This parameter is optional.  It specifies a limit on the time
  1602. that the command will wait.  (In seconds).  Any numeric
  1603. expression that results in a number between 0 and 32000 seconds.
  1604.  A value of 0 means that no time limit is present.  The user
  1605. MUST press a key to continue. Note that pause(0); can also be
  1606. written pause;.
  1607.  
  1608. Remarks    Used to wait for the user to read something on the
  1609. screen or to see a graphics file that is being displayed, 
  1610.  
  1611. Examples    ! Display a character's picture, then wait for 2
  1612. minutes or until the
  1613.  
  1614. ! player presses a key
  1615.  
  1616. if player.picture > 0 then
  1617.  
  1618.    viewpcx( player );
  1619.  
  1620.    pause(120);
  1621.  
  1622.    paint(screen);
  1623.  
  1624. endif;
  1625.  
  1626. See Also    wait
  1627.  
  1628. Random
  1629.  
  1630. Syntax    ret-val = random( expr );
  1631.  
  1632. Purpose    Return a random number between 0 and expr-1.
  1633.  
  1634. Parameters    expr
  1635.  
  1636. Is an arithmetic expression that results in a positive number
  1637. larger than 1.
  1638.  
  1639. Returns    ret-val
  1640.  
  1641. Is a value between 0 and expr-1.
  1642.  
  1643. Remarks    The expr is value is the number of alternatives you want
  1644. to consider.
  1645.  
  1646. Example    ! 3 out of every 10 times, write a message
  1647.  
  1648. if random( 10 ) < 3 then ! 0,1 and 2
  1649.  
  1650.    writeln( "We have a winner!" );
  1651.  
  1652. endif;
  1653.  
  1654.     ! generate a monster of random size
  1655.  
  1656. on random(5) gosub XTINY, XSMALL, XMEDIUM, XLARGE, XHUGE;
  1657.  
  1658. ...
  1659.  
  1660.     ! Once out of every 7 times..
  1661.  
  1662. if random(7) = 0 then ! or 1 or 2 or .. 6, but just one of them !
  1663.  
  1664.     gosub DOSOMETHING;
  1665.  
  1666. endif;
  1667.  
  1668. ReadText
  1669.  
  1670. Syntax    readtext( block# [, line#] );    or
  1671.  
  1672. readtext( "filename" );
  1673.  
  1674. Purpose    To read and display some text on the screen
  1675.  
  1676. Parameters    block#
  1677.  
  1678. Is the record number from the TEXT.DTA file.
  1679.  
  1680.     line#
  1681.  
  1682. Is the line number within the block (1 to 16) or 0 (default)
  1683. which means that the entire text record should be displayed.
  1684.  
  1685.     filename
  1686.  
  1687. Is the name of a text file to be read and displayed.
  1688.  
  1689. Remarks    If block# is given, the record is read into variables S1
  1690. through S16.
  1691.  
  1692.     If line# is non zero, only that line is displayed.
  1693.  
  1694.     The entire lines are displayed, the lines are not expected to
  1695. contain keywords of any kind (unlike dotext)
  1696.  
  1697.     If a filename is provided, the screen is cleared and the text
  1698. is displayed in full screen (but still graphics) mode.  The
  1699. paint command should be used to re-paint the screen after the
  1700. text has been read.  Also, the pause command may be used before
  1701. the paint command to give a chance to the player to read the
  1702. last page.
  1703.  
  1704.     The text file may contain some control commands that start with
  1705. the % sign as follows:
  1706.  
  1707.     %MUSIC musicfile.cmf
  1708.  
  1709. Plays the CMF format file musicfile in the background (The
  1710. SoundBlaster SBFMDRV.COM must be memory resident).
  1711.  
  1712.     %VIEWPCX pcxfile.pcx
  1713.  
  1714. Show the PCX graphics file on the screen in the resolution and
  1715. with the pallete closest to the one specified in the PCX file
  1716. that is available in the computer.
  1717.  
  1718.     %VPLAY vocfile.voc
  1719.  
  1720. Plays the VOC format file on the foreground if a SoundBlaster
  1721. card is present.
  1722.  
  1723.     %READ textfile
  1724.  
  1725. The DOS text file is read through the SoundBlaster
  1726. text-to-speach driver (SBTALKER) if installed.
  1727.  
  1728.     %SPEAK a line of  text
  1729.  
  1730. Speaks the line of text through the SoundBlaster text-to-speach
  1731. driver (SBTALKER) if installed.
  1732.  
  1733.     %PAGE
  1734.  
  1735. Say "press <SPACE> to continue" and clear the screen when the
  1736. player does press the space bar.
  1737.  
  1738.     %WAIT time
  1739.  
  1740. Wait a maximum of time seconds or until all music and/or voice
  1741. has finished playing.  If the time expires before the music or
  1742. voice is over, the music or voice is stopped.  Also, if the user
  1743. presses SPACE while waiting, the voice and music are stoped and
  1744. the wait expires.
  1745.  
  1746. Restart
  1747.  
  1748. Syntax    restart;
  1749.  
  1750. Purpose    Restart the game from the begining, but does not re-run
  1751. the introduction or cause the player to have to re-create
  1752. his/her character.
  1753.  
  1754. Remarks    From the DOS prompt, you can re-start the game by typing:
  1755.  
  1756.         C:\games> del sav*.*
  1757.  
  1758.     If you also want to re-create the playing party, type also:
  1759.  
  1760.         C:\games> del party.dta
  1761.  
  1762. Restore
  1763.  
  1764. Syntax    restore( slot# );
  1765.  
  1766. Purpose    Restores the game to a previously saved possition.
  1767.  
  1768. Parameters    slot#
  1769.  
  1770. The # of the saved game, which may be in the range 1 through 999.
  1771.  
  1772. Remarks    The restore command works by first deleting all files
  1773. with name SAV*.000 from the current directory, and then copying
  1774. all files of name SAV*.### (the saved game) to files names
  1775. SAV*.000.
  1776.  
  1777.     The current game is held in slot # 0.  Every time you transfer
  1778. from one world to another, the current game is saved to slot 0. 
  1779. This means that if your game is interrupted for any reason (for
  1780. example, you accidentaly press Ctrl-Alt-Del), your game state is
  1781. restored to the time at which you entered the current world.
  1782.  
  1783. See Also    save, restart
  1784.  
  1785. Return
  1786.  
  1787. Syntax    return;
  1788.  
  1789. Purpose    Returns execution control to the instruction following
  1790. the last gosub that was executed.
  1791.  
  1792. Remarks    To write a subroutine, you declare a label (which will
  1793. be used by the gosub statement to invoke it), followed by some
  1794. script statements, followed by the return statement.
  1795.  
  1796. Example    ! Subroutine to move one step to the right.
  1797.  
  1798. MOVERIGHT:
  1799.  
  1800. if group.x < world.x-1 and world.density <= VERY_ROUGH then
  1801.  
  1802.     inc(group.x);
  1803.  
  1804. endif;
  1805.  
  1806. return;
  1807.  
  1808. Save
  1809.  
  1810. Syntax    save( slot# );
  1811.  
  1812. Purpose    Saves the current game in the given slot.
  1813.  
  1814. Parameters    slot#
  1815.  
  1816. The slot to be used to save the game.  May be in the range 1
  1817. through 999.
  1818.  
  1819. Remarks    The save command works by copying all files with name
  1820. SAV*.000 to files of name SAV*.###.
  1821.  
  1822.     The current game is held in slot # 0.  Every time you transfer
  1823. from one world to another, the current game is saved to slot 0. 
  1824. This means that if your game is interrupted for any reason (for
  1825. example, you accidentaly press Ctrl-Alt-Del), your game state is
  1826. restored to the time at which you entered the current world.
  1827.  
  1828. See Also    restore, restart
  1829.  
  1830. Select
  1831.  
  1832. Syntax    retval = select ( group );1
  1833.  
  1834. retval = select [$[2]] ( {player|npc}  [, {matching|type}] );2
  1835.  
  1836. retval = select [$[2]] ( {player.body|npc.body} );3
  1837.  
  1838. retval = select [$] (  string [, value] [, string ... ] );4
  1839.  
  1840. Purpose    Display a list of characters, items, etc, on the menu
  1841. area, and then allow the player to select one of the displayed
  1842. items. The item selected becomes the current generic item of the
  1843. appropriate type.
  1844.  
  1845. Parameters    group, player, npc, player.body and npc.body
  1846.  
  1847. Tells the select command what you want to select from.
  1848.  
  1849.     matching
  1850.  
  1851. Used to indicate that only items that match the items of the
  1852. type carried by the current npc should be displayed.
  1853.  
  1854.     type
  1855.  
  1856. is a number or token with a value between 0 and 255.
  1857.  
  1858.     string
  1859.  
  1860. is a text string enclosed in quotes.
  1861.  
  1862.     value
  1863.  
  1864. is either a number (constant or token) or a single variable or
  1865. attribute whose value is numeric.  No arithmetic expressions are
  1866. permited.
  1867.  
  1868. Returns    The number that returns is the index to the selected
  1869. item.  
  1870.  
  1871. Remarks    If a $ is specified, then values will be displayed as
  1872. gold or silver pieces (1gp = 10sp).  The 2 following the $
  1873. indicates that the values should be divided by 2 before being
  1874. displayed.
  1875.  
  1876.  
  1877.  
  1878. 1) Select a member of the playing party.  The selected member
  1879. (if any) becomes the current player.
  1880.  
  1881.  
  1882.  
  1883. 2) Select one of the items in the character's backpack. If
  1884. matching is specified, only items that match the type of items
  1885. in the current npc's backpack will be displayed. If type is
  1886. provided, only items of the specified type are displayed.  The
  1887. selected item becomes the character's current .bp item.
  1888.  
  1889.  
  1890.  
  1891. 3) Select one of the items being worn by the current character.
  1892. The item selected becomes the current player.body item.  If the
  1893. character is not wearing any items (weapon, armor, shield, ring,
  1894. amulet or staff), no menu is displayed and the function return a
  1895. -1.
  1896.  
  1897.  
  1898.  
  1899. 4) Displays a menu with the options listed (strings), and allows
  1900. the player to select one of them. It returns the index to the
  1901. selected one.  The first item is 0.
  1902.  
  1903.     If no item is selected (player pressed <ESC> key) the function
  1904. returns -1.
  1905.  
  1906.     If the list is empty (no item is being carried in the backpack
  1907. or being worn), the function also returns -1.
  1908.  
  1909. Examples    ! Select the current spokes-person...
  1910.  
  1911. L3 = select( group );
  1912.  
  1913.     ! Show list of potions being carried and give it to the npc
  1914.  
  1915. L8 = display( player, POTION );
  1916.  
  1917. If L8 >= 0 then 
  1918.  
  1919.   move( player.bp, npc );
  1920.  
  1921. endif;
  1922.  
  1923.     ! A merchant offers to sell something.
  1924.  
  1925. L39 = select$( npc );
  1926.  
  1927. if L39 >= 0 then
  1928.  
  1929.     if group.gold >= npc.bp.value then
  1930.  
  1931.         writeln( "Sold ", npc.bp.count, " ", npc.bp.name );
  1932.  
  1933.         copy( npc.bp, player );
  1934.  
  1935.         if failure then
  1936.  
  1937.             writeln( "I'll just put it here on the floor.." );
  1938.  
  1939.             drop( npc.bp );
  1940.  
  1941.         endif;
  1942.  
  1943.         dec( group.gold, npc.bp.value );
  1944.  
  1945.     else
  1946.  
  1947.         writeln( "You don't have enough money!" );
  1948.  
  1949.     endif;
  1950.  
  1951. else
  1952.  
  1953.     writeln( "Ok.." );
  1954.  
  1955. endif;
  1956.  
  1957.  
  1958.  
  1959.     ! Display the player's items that the merchant might want to
  1960. buy.
  1961.  
  1962. L39 = select$2( player, matching );
  1963.  
  1964. if L39 >= 0 then
  1965.  
  1966.     writleln( "Here is ", $player.bp.value," for your
  1967. ",player.bp.name);
  1968.  
  1969.     inc( group.gold, player.bp.value / 2 );
  1970.  
  1971.     move( player.bp, npc );
  1972.  
  1973. endif;
  1974.  
  1975.     ! Give the player a choice and take the appropriate action..
  1976.  
  1977. :XAGAIN
  1978.  
  1979. on select("Yes", "No","Maybe") goto XYES, XNO, XMAYBE;
  1980.  
  1981. goto XNONE;
  1982.  
  1983. :XYES
  1984.  
  1985.     writeln( "Good stuff..." );
  1986.  
  1987.     goto SOMEWHERE;
  1988.  
  1989. :XNO
  1990.  
  1991.     writeln("Too bad..." );
  1992.  
  1993.     goto SOMEWHERE;
  1994.  
  1995. :MAYBE
  1996.  
  1997.     writeln( "Will you make up your mind?" );
  1998.  
  1999.     goto XAGAIN;
  2000.  
  2001. :SOMEWHERE
  2002.  
  2003.     ! Now do something else..
  2004.  
  2005. See Also    display
  2006.  
  2007. SetBody
  2008.  
  2009. Syntax    setbody( which, type );
  2010.  
  2011. Purpose    Select the worn item represented by the generic variable
  2012. player.body or npc.body.
  2013.  
  2014. Parameters    which
  2015.  
  2016. Is one of the npc or player attributes .body, .weapon, .armor,
  2017. .shield, .ring, .amulet or .staff.
  2018.  
  2019.     type
  2020.  
  2021. Is an expression that evaluates to one of the six relevant types
  2022. (represented by tokens WEAPON, ARMOR, SHIELD, RING, AMULET or
  2023. STAFF).  Any other value is invalid.
  2024.  
  2025. Remarks    When specifying npc.body or player.body, the type is
  2026. required.
  2027.  
  2028.     When specifying npc.weapon, npc.armor, etc, the type is
  2029. invalid, since it is implied by the attribute itself.
  2030.  
  2031. SetBp
  2032.  
  2033. Syntax    setbp( which, expr );
  2034.  
  2035. Purpose    Select the backpack item represented by the generic
  2036. variable player.bp or npc.bp.
  2037.  
  2038. Parameters    which
  2039.  
  2040. Is one of npc.bp or player.bp, to identify which backpack you
  2041. want to set.
  2042.  
  2043.     expr
  2044.  
  2045. Is an expression resulting in a number between 0 and 15, which
  2046. indicates the position within the backpack that is to be
  2047. represented by the generic variable.
  2048.  
  2049. Remarks    The backpack position may be empty (i.e. not contain a
  2050. valid item).
  2051.  
  2052.     You can tell if an item is present by testing the count
  2053. attribute.  A value of zero always implies that the item does
  2054. not exist.
  2055.  
  2056. Sign
  2057.  
  2058. Syntax    ret-val = sign( expr  );
  2059.  
  2060. Purpose    To determine whether an expression is negative, positive
  2061. or zero.
  2062.  
  2063. Parameters    expr
  2064.  
  2065. A single expression whose numeric value may be negative,
  2066. positive or exactly zero.
  2067.  
  2068. Returns    Returns -1 (minus one) if the expression is negative, +1
  2069. (plus one) if the expression is positive and 0 (zero) if the
  2070. expression is exactly zero.
  2071.  
  2072. Remarks    This function may be useful when it is not important to
  2073. know the magnitude of the difference between two values, but
  2074. just whether one of them is greater than the other.
  2075.  
  2076. Examples    ! The character is about to hit the npc.  The npc has a
  2077. 1 in 4 chance of
  2078.  
  2079. ! blocking the attack (25%), but it may be modified to 1 in 3 if
  2080. the npc has
  2081.  
  2082. ! a higher dexterity than the player, or to 1 in 5 if the player
  2083. has the better
  2084.  
  2085. ! dexterity.
  2086.  
  2087. L7 = 4 + sign( player.dex - npc.dex );
  2088.  
  2089.     ! Another version of the above computes an adjustment based on
  2090. the
  2091.  
  2092. ! player's AND npc's dexterity using the adjustments function,
  2093. and adds
  2094.  
  2095. ! or substracts the adjustment based on who is better.  This
  2096. means that
  2097.  
  2098. ! A high player dexterity OR a low npc dexterity will decrease
  2099. the ability
  2100.  
  2101. ! of the npc to block the attack.
  2102.  
  2103. L7 = 4 + sign(player.dex-npc.dex) *
  2104. adjustments(player.dex,npc.dex);
  2105.  
  2106. Stats
  2107.  
  2108. Syntax    stats; or stats( who );
  2109.  
  2110. Purpose    Tells the system to display character statistics in the
  2111. menu area, if they are not currently being displayed.
  2112.  
  2113. Parameters    who
  2114.  
  2115. Tells the system whose statistics you want to display.
  2116.  
  2117.     -1 means that the system should re-display the statistics we
  2118. were already showing.  This is useful when the menu area has
  2119. been used for something else, like the display command.
  2120.  
  2121.     0 to group.size-1 indicates that you wish to display detailed
  2122. statistics for the given player (usually group.current)
  2123.  
  2124.     group.size (or any number larger than the number of players in
  2125. the group), indicates that you want to see the group summary
  2126. statistics (a couple of lines for each character in the group).
  2127.  
  2128. Remarks    Statistics are displayed more or less automaticly, but
  2129. during the execution of a script, you can use the menu area for
  2130. other things. If you want to restore the statistics at any time,
  2131. you may use the stats function.
  2132.  
  2133.     If you omit the parameter (stats;), the group summary
  2134. statistics are displayed.
  2135.  
  2136. Example    ! Refresh the statistics area
  2137.  
  2138. stats(-1);
  2139.  
  2140.     ! Display the current player's detailed statistics
  2141.  
  2142. stats( group.current ); Stop
  2143.  
  2144. Syntax    stop;
  2145.  
  2146. Purpose    Terminates execution of the script.
  2147.  
  2148. Remarks    Indicates that the script has performed all required
  2149. actions.
  2150.  
  2151. See Also    continue, fight
  2152.  
  2153. Success
  2154.  
  2155. Syntax    ret-val = success;
  2156.  
  2157. Purpose    To find out if the last major operation was successful.
  2158.  
  2159. Returns    ret-val
  2160.  
  2161. The returns will be non-zero (TRUE) if the last major operation
  2162. completed successfuly.
  2163.  
  2164. Example    ! A merchant sells an item to a player..
  2165.  
  2166. writeln( "Here is your ", npc.bp.name );
  2167.  
  2168. copy( npc.bp, player.bp );
  2169.  
  2170. if success then
  2171.  
  2172.     writeln( "Sold!" );
  2173.  
  2174. else
  2175.  
  2176.     writeln( "The ", npc.bp.name, " is placed on the floor.." );
  2177.  
  2178.     drop( npc.bp );
  2179.  
  2180. endif;
  2181.  
  2182. See Also    failure
  2183.  
  2184. system
  2185.  
  2186. Syntax    system( argument1 [ , argument2 ... ] );
  2187.  
  2188. Purpose    Execute a DOS command.
  2189.  
  2190. Parameters    argumentN
  2191.  
  2192. Is a a string constant, variable or attribute, or a numeric
  2193. constant, token, variable or attribute.  No expressions are
  2194. allowed.
  2195.  
  2196. Remarks    The system command will create a single string by
  2197. concatenating the values of the arguments in very much the same
  2198. way that the writeln command does.  The resulting string is
  2199. assumed to be a DOS command that needs to be executed.
  2200.  
  2201.     If the numeric attributes type or class are displayed, the
  2202. associated string listed in the token file (DCCTOKEN.DAT) is
  2203. used, instead of the numeric value.
  2204.  
  2205.     If a numeric argument is preceeded by a $ sign, the value is
  2206. represented in gold or silver pieces.
  2207.  
  2208.     The failure will be set to the value returned by the DOS
  2209. command.  The value can be tested for non-zero (i.e. just a
  2210. failure) or for it's numeric value, which can have any meaning
  2211. that the DOS command chose to give that value.
  2212.  
  2213. Examples    ! Assuming you have a CASINO game that receives as
  2214. parameters the 
  2215.  
  2216. ! name of the player and the amount of money to start with:
  2217.  
  2218. system( "CASINO ", player.name, " ", group.gold / 10 );
  2219.  
  2220. group.gold = failure * 10; ! Earnings stored in the return value
  2221.  
  2222.  
  2223.  
  2224. ! Another example.  Asume you have a DOS program that manages
  2225. your
  2226.  
  2227. ! saved games, you can call:
  2228.  
  2229. save(0);                ! Save current game 
  2230.  
  2231. system(  "SAVER SAVE" );    ! Store it somewhere 
  2232.  
  2233.     ! or:
  2234.  
  2235. system( "SAVER RESTORE" );    ! Retrieve a saved game to slot 0
  2236.  
  2237. restore(0);                ! Cause the system to re-load slot 0.
  2238.  
  2239. Teleport
  2240.  
  2241. Syntax    teleport( dest_world [, dest_door] );
  2242.  
  2243. teleport( dest_world, dest_x, dest_y );
  2244.  
  2245. Purpose    When the current script finishes execution, the party
  2246. will be transfered to the given world at the location indicated
  2247. by the given door.
  2248.  
  2249. Parameters    dest_world
  2250.  
  2251. Is the index number of the destination world (0-999)
  2252.  
  2253.     dest_door
  2254.  
  2255. Is the door in the destination world, over which the party will
  2256. be placed.  The default is door 0.
  2257.  
  2258.     dest_x, dest_y
  2259.  
  2260. The coordinates in the destination world at which the party will
  2261. be placed (No door is needed).
  2262.  
  2263. Remarks    Unlike the enter command, no door leading from the
  2264. current world to the destination world is used.  The transfer is
  2265. made directly to the world and location indicated.
  2266.  
  2267. Examples    ! Transfer the party to one of 3 worlds at random
  2268.  
  2269. L3 = random(3);
  2270.  
  2271. if L3 = 0 then
  2272.  
  2273.     teleport( 38 );  ! Teleport to world 38, door 0
  2274.  
  2275. elsif L3 = 1 then
  2276.  
  2277.     teleport( 5, random(2) ); ! Teleport to world 5, door 0 or 1
  2278. (random)
  2279.  
  2280. else
  2281.  
  2282.     teleport( 43, 25, 32 );      ! Teleport to world 43,
  2283. location X=25, Y=32
  2284.  
  2285. endif;
  2286.  
  2287. See Also    enter
  2288.  
  2289. Vanish
  2290.  
  2291. Syntax    vanish( object );
  2292.  
  2293. Purpose    Destroy an object.
  2294.  
  2295. Parameters    object
  2296.  
  2297. Is the object to be destroyed. It can be any of the following:
  2298. player.bp, player.body, player.weapon, player.shield,
  2299. player.armor, player.ring, player.amulet, player.staff, npc.bp,
  2300. npc.body, npc.weapon, npc.shield, npc.armor, npc.ring,
  2301. npc.amulet, npc.staff, object, curritem or group.vehicle.
  2302.  
  2303. Remarks    The object is removed and will no longer be available
  2304. anywhere.
  2305.  
  2306.     This is almost equivalent to setting the count attribute of the
  2307. object to 0, which in effect means that the object is no longer
  2308. there.
  2309.  
  2310. See Also    drop, move, copy
  2311.  
  2312. Version
  2313.  
  2314. Syntax    ret-val = version;
  2315.  
  2316. Purpose    Determine the current version of the DCGAMES software
  2317. being used to run the adventure.
  2318.  
  2319. Returns    The version of the game driver in use.
  2320.  
  2321. Remarks    The version number is in the hundreds.  Version 3.00 is
  2322. returned as 300 (three hundred).  Version 3.01 would be returned
  2323. as 301 (three hundred and one).
  2324.  
  2325.     Since version 3.0 of DCGAMES is the first version to support
  2326. scripts, there should be little use for this function.  As later
  2327. versions become available which add new features, you might want
  2328. to verify that the correct version of the driver is being used.
  2329.  
  2330. Example    if version < 300 then
  2331.  
  2332.     writeln( "Something strange is going on here!" );
  2333.  
  2334. endif;
  2335.  
  2336. ViewPcx
  2337.  
  2338. Syntax    viewpcx( character ); or
  2339.  
  2340. viewpcx( object ); or
  2341.  
  2342. viewpcx( world ); or
  2343.  
  2344. viewpcx( "filename.pcx" );
  2345.  
  2346. Purpose    Display a PCX graphics file on the screen
  2347.  
  2348. Parameters    character
  2349.  
  2350. If you specify player or npc, the characters picture attribute
  2351. will be used to create a filename of the form CPICT###.PCX,
  2352. where ### is the numeric value of the picture attribute.
  2353.  
  2354.     object
  2355.  
  2356. If you specify an object (object, curritem, player.bp, etc..)
  2357. then the object's picture attribute will be used to create a
  2358. filename of the form OPICT###.PCX, where ### is the numeric
  2359. value of the picture attribute.
  2360.  
  2361.     world
  2362.  
  2363. If you specify world, the index attribute of the world (i.e the
  2364. world's number) will be used to create a filename of the form
  2365. WORLD###.PCX, where ### is the world's index value.
  2366.  
  2367.     "filename.pcx"
  2368.  
  2369. Is a quoted string which contains a valid DOS filename. The
  2370. filename is used exactly as given. (i.e. an extension of .PCX is
  2371. NOT automaticly added).
  2372.  
  2373. See Also    paint
  2374.  
  2375. Voice
  2376.  
  2377. Syntax    voice( "keyword" [, vfl ] );
  2378.  
  2379. Purpose    Play back a voice recording.
  2380.  
  2381. Parameters    keyword
  2382.  
  2383. The keyword is a one 1 to 8 character word that identifies the
  2384. voice recording in the VFL file.  Each VFL file may contain up
  2385. to 64 voices of 64K each.
  2386.  
  2387.     vfl
  2388.  
  2389. Is the voice file (VFL) that contains the voice you want to
  2390. play.  If not specified, then the voice file associated with the
  2391. current npc (if any) is assumed.
  2392.  
  2393. Remarks    If the character has an associated voice file (voice
  2394. attribute), the voice file (VOICEnnn.VFL) is searched for a
  2395. recording with the given keyword. If present, the voice is
  2396. played back.
  2397.  
  2398.     If the character's voice attribute is -1, it indicates that no
  2399. voice file is associated with the character.  The voice
  2400. attribute may have values between 0 and 999.
  2401.  
  2402.     If a vfl parameter is proviced, a value of 1000 may be used to
  2403. indicate that the voice file DCSOUNDS.VFL should be searched
  2404. instead.  This file contains generic sound effects that are used
  2405. during battles and may be used anywhere by any script.
  2406.  
  2407. Examples    ! The character tried to open a chest and it was
  2408. trapped..
  2409.  
  2410. if rand(3) = 0 then ! Trap
  2411.  
  2412.     voice( "Explode", 1000 );
  2413.  
  2414.     writeln( "Argh..." );
  2415.  
  2416. endif;
  2417.  
  2418. See Also    dotext, vplay, music
  2419.  
  2420. VPlay
  2421.  
  2422. Syntax    vplay( "voicefile.voc" );
  2423.  
  2424. Purpose    Play back a voice recording file.
  2425.  
  2426. Parameters    voicefile.voc
  2427.  
  2428. The file voicefile.voc is loaded and played through the
  2429. SoundBlastertm if it is present.
  2430.  
  2431. Remarks    Only the SoundBlaster series of audio cards is supported
  2432. at this time.
  2433.  
  2434.     The file must be stored in the .VOC format, must be shorter
  2435. than 64K and must fit in available memory.
  2436.  
  2437. See Also    dotext, voice, music
  2438.  
  2439. Wait
  2440.  
  2441. Syntax    wait( time );
  2442.  
  2443. Purpose    Wait until all voice and music has finished playing, or
  2444. time seconds have passed.
  2445.  
  2446. Parameters    time
  2447.  
  2448. The maximum number of seconds to wait.  May be in the range 0 to
  2449. 32000.
  2450.  
  2451. Remarks    A time of 0 indicates that there is no time limit.  If
  2452. no music is present, this is equivalent to pause(0); The wait
  2453. ends when either no more voice or music is playing, the user
  2454. pressed the SPACE bar or the specified time has elapsed.
  2455.  
  2456.     If the time limit is reached or the player presses a key, the
  2457. music and voice still playing is stoped.
  2458.  
  2459. Example    ! Play some Background music
  2460.  
  2461. music( "overture.cmf" );    ! Start playing music
  2462.  
  2463. viewpcx( "map.pcx" );    ! Display a picture on the screen
  2464.  
  2465. wait(0);            ! Wait until the music ends or SPACE bar
  2466.  
  2467. paint( SCREEN );        ! re-paint the screen.
  2468.  
  2469. See Also    pause, music, voice, vplay, viewpcx, dotext, paint
  2470.  
  2471. While
  2472.  
  2473. Syntax    while expr do statements; endwhile;
  2474.  
  2475. Purpose    Execute a set of statements as long as the expression is
  2476. non-zero
  2477.  
  2478. Parameters    expr
  2479.  
  2480. Is a logical expression which results in a numeric value.
  2481.  
  2482. Remarks    The expression expr is evaluated and the statements are
  2483. executed until the expression results in a value of zero.
  2484.  
  2485. Examples    ! Ask a question, demand an answer.
  2486.  
  2487. writeln( "Do you agree? (Yes/No)" );
  2488.  
  2489. L3 = getstr( "yes", "no" );
  2490.  
  2491. while L3 < 0 do
  2492.  
  2493.     writeln( "You must say  Yes or No" );
  2494.  
  2495.     L3 = getstr( "yes", "no" );
  2496.  
  2497. endwhile;
  2498.  
  2499. Write[ln]
  2500.  
  2501. Syntax    write( argument [ , argument ... ] );
  2502.  
  2503. writeln[( argument [, argument] )];
  2504.  
  2505. Purpose    Display a line of text on the text area of the screen.
  2506.  
  2507. Parameters    argument
  2508.  
  2509. Is a a string constant, variable or attribute, or a numeric
  2510. constant, token, variable or attribute.  No expressions are
  2511. allowed.
  2512.  
  2513. Remarks    The write command is used to indicate that subsequent
  2514. write or writeln commands will continue writing on the same line
  2515. as this one, unless the line is full.
  2516.  
  2517.     The writeln command indicates that subsequent write or writeln
  2518. commands will start writing on a new line.
  2519.  
  2520.     If the numeric attributes type or class are displayed, the
  2521. associated string listed in the token file (DCCTOKEN.DAT) is
  2522. displayed, instead of the numeric value.
  2523.  
  2524.     If a numeric argument is preceeded by a $ sign, it is displayed
  2525. in gold/silver pieces.
  2526.  
  2527. Examples    ! The following command
  2528.  
  2529. writeln( "Sold ",  L7,  " ", npc.bp.name, " at ", $npc.bp.value
  2530. );
  2531.  
  2532. ! might display
  2533.  
  2534.     Sold 5 Pumkin Pies for 3gp
  2535.  
  2536. ! if npc.bp.name = "Pumkin Pies" and npc.bp.value = 30
  2537.  
  2538.     ! The following command
  2539.  
  2540. write( "You see a ", object.name, " (", object.type, ")" );
  2541.  
  2542. if object.type = WEAPON and object.hands = 2 then
  2543.  
  2544.    writeln( " (Two-Handed) " );
  2545.  
  2546. else
  2547.  
  2548.    writeln; ! End the line..
  2549.  
  2550. endif;
  2551.  
  2552. ! might display
  2553.  
  2554.     You see a Rusty Knife (Weapon)
  2555.  
  2556. 
  2557.